package com.ldh.spring_sucurity.entity;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;

import javax.persistence.*;

/**
 * @author LiuDehuai
 * @fileName:Role
 * @Date:2020/9/29 9:31
 * <author>     <time>     <version>    <desc>
 * 作者姓名       修改时间    版本号       描述
 */

/**
 * 实现GrantedAuthority接口，实现getAuthority
 */
@Entity
@Data
public class Role implements GrantedAuthority {
    /**
     * 主键自增
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @Column(nullable = false)
    private String name;

    /**
     * 返回角色的权限
     * @return
     */
    @Override
    public String getAuthority() {
        return name;
    }
}
